<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <meta name="author" content="Mickael Faivre-Macon">
        <meta name="keywords" content="ptm, project, task, manager">
        <meta name="description" content="A project and task manager">
        <meta name="robots" content="all">
        <title>PTM - Project and Task Manager</title>
  <%= stylesheet_link_merged :base %>
        <link rel="Shortcut Icon" type="image/x-icon" href="/images/favicon.ico">
</head>
<body>
<div id="container">
<%
user = User.find(session['user'])
user.last_login = Time.now()
user.save
logo = 'hide'
logo = 'display' if user and user.settings.toggle == 'display'
%>
<div id="logo"<%if(logo!='display') %> style="display:none;"<%end%>>Project and Task Manager</div>
<% cur = @controller.class.controller_path -%>
<div id="header">
<%
project_id = (session[:selected_project] || 0).to_i
project = project_id==0 ? nil:Project.find(project_id)
%>
<span id="selected_project"><%= project ? project.name : "Displaying all projects" %></span>

<span class="quick_add"><a href="#" onclick="show_qa();">quick add</a></span>
<span <% if cur=="welcome" then%>id="currentmenuline" <%end%>class="menuline"><a href="/">dashboard</a></span>
<span <% if cur=="project" then%>id="currentmenuline" <%end%> class="menuline"><a href="/project">projects</a></span>
<span <% if cur=="task" then%>id="currentmenuline" <%end%> class="menuline"><a href="/task">tasks</a></span>
<!--<span <% if cur=="writeboards" then%>id="currentmenuline" <%end%> class="menuline"><a href="/writeboards">writeboards</a></span>-->
<span <% if cur=="calendar" then%>id="currentmenuline" <%end%> class="menuline"><a href="/calendar">calendar</a></span>
<span <% if cur=="myinfo" then%>id="currentmenuline" <%end%> class="menuline"><a href="/myinfo">profile</a></span>
<span id="logout"><a href="/account/logout">logout</a></span>
<span class="menuline2"><a href="#" onclick="toggle_logo();return false;">toggle</a></span>
</div>
<div id="side">
<% if user.email==nil or user.email==''-%>
<div class="menu title">Email</div>
<div class="menu content">
You didn't <%=link_to("set your email", :controller=>:myinfo)%>. If you forget your password, you will not be able to retreive it.<br/><br/>
</div>
<% end -%>


<!-- Project list -->

<% if user.projects.size > 0 %>
<div class="menu title">Projects</div>
<div class="menu content">
<ul id="project_list" class="project_list">
<%= render(:partial=>"user/project_list", :locals=>{:user=>user}) %>
</ul>
</div>
<% end %>

<!-- Bookmarks -->

<div class="menu title">Bookmarks</div>
<div class="menu content">
<ul id="bm">
<%= render(:partial=>'bookmarks/bookmark', :collection=>user.bookmarks)%>
</ul>
</div>

<div id="notice"><% if flash[:notice] -%><div class="menu title">Notice</div><div class="menu content"><%= flash[:notice] %></div><% end -%></div>
<div id="info"><% if flash[:info] -%><div class="menu title">Info</div><div class="menu content"><%= flash[:info] %></div><% end -%></div>
<div id="members"><% if flash[:members] -%><%= flash[:members] %><% end -%></div>


<%
  coworkers = user.coworkers
  if(coworkers.size > 1)%>
    <div class="menu title">On site</div>
    <div class="menu content">
    <ul class="project_list">
    <%
    coworkers.sort_by { |u| l = u.last_login; l ? l : Time.at(0)  }.reverse.each do |u|
      next if not u.last_login %>
      <li><b><%= u.name %></b> <%= time_ago_in_words(u.last_login) %></li/><%
    end%>
    </ul>
    </div>
    <br/><%
  end %>

<br/>
<a target="_blank" class="btnlnk" href="http://code.google.com/p/rorptm/">Open Source</a>

</div>

<!-- Search -->

<div id="content">
<% form_remote_tag(:url=>{:controller=>'task', :action=>'display_tasks_search_results'}, :update=>'search') do %>
Search
<input id="search_input" name="task[title]" size="70" type="text" /><div class="auto_complete" id="search_input_auto_complete"></div>
<%
# commented because Ajax is not defined yet
#= my_text_field_with_auto_complete(:task, :title, {:size=>70, :id=>'search_input'}, :skip_style => true)
%>
<%= link_to_function('hide results','$("search").update("");$("search_input").value = ""') %>
<%end%>
<div id="search"></div>

<!-- yield -->

<%= yield %>

<p><br/></p>
</div>

<div id="footer">
PTM beta version |
Tested mainly with firefox |
For any ideas, please write to us: <a href="mailto:protask@protaskm.com">protask@protaskm.com</a> |
<a href="/newfeatures.xml">RSS</a> |
<a href="/privacy.html">Privacy</a> |
<a href="/terms.html">Terms of service</a> | Design by <a href="http://www.kumi.co.nr">Kumiko</a>
</div>

</div>

<!-- JS -->

<%= javascript_include_merged :base %>

<script type="text/javascript">
//<![CDATA[
var search_input_auto_completer = new Ajax.Autocompleter('search_input', 'search_input_auto_complete', '/welcome/auto_complete_for_task_title', {})
//]]>
</script>

<!-- Google Analytics -->

<% if(request.host!="127.0.0.1")  -%>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
<script type="text/javascript">
_uacct = "UA-88514-5";
urchinTracker();
</script>
<% end -%>

</body>
</html>
